load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@tink_py_pip_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

py_library(
    name = "aead",
    srcs = ["__init__.py"],
    srcs_version = "PY3",
    visibility = ["//visibility:public"],
    deps = [
        ":_aead",
        ":_aead_key_manager",
        ":_aead_key_templates",
        ":_kms_envelope_aead",
    ],
)

py_library(
    name = "_aead",
    srcs = ["_aead.py"],
    srcs_version = "PY3",
)

py_library(
    name = "_aead_key_manager",
    srcs = ["_aead_key_manager.py"],
    srcs_version = "PY3",
    deps = [
        ":_aead",
        ":_aead_wrapper",
        "//tink/cc/pybind:tink_bindings",
        "//tink/core",
    ],
)

py_test(
    name = "_aead_key_manager_test",
    srcs = ["_aead_key_manager_test.py"],
    srcs_version = "PY3",
    deps = [
        ":aead",
        requirement("absl-py"),
        "//tink:tink_python",
        "//tink/core",
        "//tink/proto:aes_ctr_hmac_aead_py_pb2",
        "//tink/proto:aes_eax_py_pb2",
        "//tink/proto:aes_gcm_py_pb2",
        "//tink/proto:aes_gcm_siv_py_pb2",
        "//tink/proto:common_py_pb2",
        "//tink/proto:tink_py_pb2",
        "//tink/proto:xchacha20_poly1305_py_pb2",
    ],
)

py_library(
    name = "_aead_wrapper",
    srcs = ["_aead_wrapper.py"],
    srcs_version = "PY3",
    deps = [
        ":_aead",
        requirement("absl-py"),
        "//tink/core",
    ],
)

py_test(
    name = "_aead_wrapper_test",
    srcs = ["_aead_wrapper_test.py"],
    srcs_version = "PY3",
    deps = [
        ":aead",
        requirement("absl-py"),
        "//tink:tink_python",
        "//tink/proto:tink_py_pb2",
        "//tink/testing:keyset_builder",
    ],
)

py_library(
    name = "_aead_key_templates",
    srcs = ["_aead_key_templates.py"],
    srcs_version = "PY3",
    deps = [
        "//tink/proto:aes_ctr_hmac_aead_py_pb2",
        "//tink/proto:aes_eax_py_pb2",
        "//tink/proto:aes_gcm_py_pb2",
        "//tink/proto:aes_gcm_siv_py_pb2",
        "//tink/proto:common_py_pb2",
        "//tink/proto:kms_aead_py_pb2",
        "//tink/proto:kms_envelope_py_pb2",
        "//tink/proto:tink_py_pb2",
    ],
)

py_test(
    name = "_aead_key_templates_test",
    srcs = ["_aead_key_templates_test.py"],
    srcs_version = "PY3",
    deps = [
        ":aead",
        requirement("absl-py"),
        "//tink/proto:aes_ctr_hmac_aead_py_pb2",
        "//tink/proto:aes_eax_py_pb2",
        "//tink/proto:aes_gcm_py_pb2",
        "//tink/proto:aes_gcm_siv_py_pb2",
        "//tink/proto:common_py_pb2",
        "//tink/proto:kms_aead_py_pb2",
        "//tink/proto:kms_envelope_py_pb2",
        "//tink/proto:tink_py_pb2",
    ],
)

py_library(
    name = "_kms_envelope_aead",
    srcs = ["_kms_envelope_aead.py"],
    srcs_version = "PY3",
    deps = [
        ":_aead",
        "//tink/core",
        "//tink/proto:tink_py_pb2",
    ],
)

py_test(
    name = "_kms_envelope_aead_test",
    srcs = ["_kms_envelope_aead_test.py"],
    srcs_version = "PY3",
    deps = [
        ":aead",
        requirement("absl-py"),
        "//tink:tink_python",
        "//tink/core",
        "//tink/proto:aes_gcm_py_pb2",
    ],
)
